<extend name="./base" />
<block name="pageContent">
    <link rel="stylesheet" href="{$Think.config.DOMAIN_URL}/Public/AdminTpl/css/s-settle.css">
    <style>
        .table > thead > tr .name1,
        .table > tbody > tr .name1 {
            padding-left: 20px;
        }

        .line-height-30 {
            line-height: 30px;
        }

        .btn-add,.btn-del {
            display: inline-block;
            padding: 4px 22px;
            border-radius: 80px;
            border: 1px solid red;
            background: #fff;
            color: red;
            margin-left: 10px;
        }
        .btn-add{
            border: 1px solid #0451D7;
            color: #0451D7;
        }
        .no-flex{
            display: inherit;
        }
        .stock-list-add{
            margin-bottom: 10px;
        }
        .s_form-textarea  .width-10{
            width:60px;
        }
    </style>
    <div class="main-content">
        <!-- 头部面包屑导航条 -->
        <div class="breadcrumbs" id="breadcrumbs">
            <!--导航路径列表-->
            <ul class="breadcrumb no-margin-left">
                <li>
                    <a>管理后台</a>
                </li>
                <li class="action">
                    股票管理
                </li>
            </ul>
        </div>
        <!--页面容器-->
        <div class="page-content">
            <div class="nav-tab" style="position: relative">
                <ul class="nav-tab-title ">
                    <li class="nav-this">编辑股票</li>
                </ul>
            </div>
            <div class="row">
                <div class="col-xs-12">
                    <div class="row">
                        <form class="jsform" method="post" action="{$Think.config.DOMAIN_URL}/stock/editData">
                            <input  name="id" class="form-control" type="hidden" value="{$selfInfo.id}">
                            <input  name="page" class="form-control" type="hidden" value="{$page}">
                            <div class="s_form-textarea">
                                <span>股票代码</span>
                                <input type="text" name="stock_no" class="s_form-width" value="{$selfInfo.stock_no}" datatype="*" placeholder="请输入股票代码"/>
                            </div>
                            <div class="s_form-textarea">
                                <span>股票名称</span>
                                <input type="text" name="stock_name" class="s_form-width" value="{$selfInfo.stock_name}" datatype="*" placeholder="请输入股票名称"/>
                            </div>
                            <div class="s_form-textarea">
                                <span>总股本</span>
                                <input type="number" name="stock_num" class="s_form-width" value="{$shRes.stock_num}" datatype="*" placeholder="请输入总股本"/>
                            </div>
                            <div class="s_form-textarea">
                                <span>上市价格</span>
                                <input type="number" name="begin_price" class="s_form-width" value="{$selfInfo.begin_price}" datatype="*" placeholder="请输入上市价格"/>
                            </div>
                            <div class="s_form-textarea">
                                <span>交易所 </span>
                                <select class="form-control s_form-width" datatype="*" name="tpid">
                                    <option value="">请选择</option>
                                    <foreach name="allPlace" item="vo" key="k">
                                        <option value="{$k}" <eq name="selfInfo.tpid" value="$k">selected</eq>>{$vo}</option>
                                    </foreach>
                                </select>
                            </div>
                            <div class="s_form-textarea clearfix no-flex">
                                <span class="pull-left">持股机构</span>
                                <div class="pull-left" id="stockCpDiv">
                                    <volist name="scList" id="vo" key="k">
                                        <div class="stock-list-add">
                                            <input placeholder="请输入持股机构" value="{$vo.name}" name="cpname[]" class="form-control s_form-width">
                                            <span class="line-height-30 width-10">占股</span>
                                            <input placeholder="请输入占股比例" value="{$vo.percent}" name="stocknum[]" type="number" class="form-control s_form-width">
                                            <eq name="k" value="1">
                                                <button type="button" class="btn-add" onclick="addStockCp()">新增</button>
                                            <else/>
                                                <button type="button" class="btn-del" onclick="delStockCp(this)">删除</button>
                                            </eq>
                                        </div>
                                    </volist>
                                </div>
                            </div>
                            <div style="margin: 50px 80px;">
                                <button type="submit"  class="btn " style="width: 100px; border-radius: 2rem; background: #0451d7!important;border:1px solid #0451d7;margin-left: 20px;">确定</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        $(".jsform").Validform();
        function addStockCp() {
            var html = '<div class="stock-list-add"><input placeholder="请输入持股机构" name="cpname[]" class="form-control s_form-width"><span class="line-height-30 width-10">占股</span><input placeholder="请输入占股比例" name="stocknum[]" type="number" class="form-control s_form-width"><button class="btn-del" onclick="delStockCp(this)">删除</button></div>';
            $('#stockCpDiv').append(html);
        }
        function delStockCp(that) {
            $(that).parent().remove();
        }
    </script>
</block>